package net.tplusplus.drools.speedtest.bank;

import net.tplusplus.drools.speedtest.facts.Cashflow;

/**
 * This class provides a simple Bank Account.
 * 
 * @author DunningJ
 *
 */
public class Account
{
	private long accountNo;
	private double balance=0;
	
	public Account(){};
	
	public Account(long accountNo)
	{
		this.accountNo = accountNo;
	}

	public long getAccountNo()
	{
		return accountNo;
	}

	public void setAccountNo(long accountNo)
	{
		this.accountNo = accountNo;
	}

	public double getBalance()
	{
		return balance;
	}

	public void setBalance(double balance)
	{
		this.balance = balance;
	}
	
	/**
	 *  This method enables the comparison of Account objects
	 */	
	@Override
	public boolean equals(Object obj) 
	{
		if(obj==null || !(obj instanceof Cashflow))
		{
			return false;
		}
		
		Account account = (Account) obj;
		
		return (getAccountNo()==account.getAccountNo());
	}	
	
	public String toString()
	{
		return "Account[" 
				+"accountNo="+accountNo
				+",balance="+balance
				+"]";
	}
}
